<?php

/**
 * vtnsSEO provides basic S.E.O utility methods.
 *
 * @package    vtns
 * @subpackage util
 * @author     Ky Anh Truong <kyanh.truong@vtns.vn>
 * @version    SVN: $Id: vtnsSEO.class.php 29525 2012-08-28 15:00:00Z kyanh $
 */
 
class vtnsSlot
{
	public static function getNavBars()
	{
		$q = Doctrine_Query::create()
	  		->from('VTNSCmsCategory c')
			->where('cms_type = 0')
			->orderBy('position');
	  return $q->fetchArray();
	}
	
public static function getRightBlocks()
	{
	  $q = Doctrine_Query::create()
	  		->from('VTNSCmsCategory c')
			->where('cms_type = 2')
			->orderBy('position DESC');
	  $rightBlocks = $q->fetchArray();
	  foreach ($rightBlocks as $key=>$rightBlock)
	  {
		  $c = Doctrine_Query::create()
		  		->from('VTNSCms c')
				->where('cms_category_id = ?', $rightBlock['cms_category_id'])
				->addWhere('is_active = 1');
				
	  	  $rightBlocks[$key]['cms_array'] = $c->fetchArray();
	  }
	  $visa_require_cat = Doctrine_Core::getTable("VTNSCmsCategory")->findOneByAlias("dich-vu-thong-cong-nghet");
	  $c = Doctrine_Query::create()
	  		->from("VTNSCms c")
			->where('cms_category_id = ?', $visa_require_cat->cms_category_id)
			->addWhere('is_active = 1');
	  $rightBlocks['dich-vu-thong-cong-nghet']['cms_category_id'] = $visa_require_cat->cms_category_id;
	  $rightBlocks['dich-vu-thong-cong-nghet']['cms_array'] = $c->fetchArray();
	  return $rightBlocks;
	}
	 
	public static function getMenuBottoms()
	{
	  $q = Doctrine_Query::create()
	  		->from('VTNSCmsCategory c')
			->where('cms_type = 3')
			->orderBy('position DESC');
	  $menuBottoms = $q->fetchArray();
	  foreach ($menuBottoms as $key=>$menuBottom)
	  {
		  $c = Doctrine_Query::create()
		  		->from('VTNSCms c')
				->where('cms_category_id = ?', $menuBottom['cms_category_id'])
				->addWhere('is_active = 1');
				
		  $menuBottoms[$key]['cms_array'] = $c->fetchArray();
	  }
	  return $menuBottoms;
	}
	
	public static function getBottom()
	{
	  $q = Doctrine_Query::create()
	  		->from('VTNSCmsCategory c')
			->where('cms_type = 4')
			->orderBy('position DESC');
	  $bottoms = $q->fetchArray();
	  $bottom = false;
	  foreach ($bottoms as $key=>$menuBottom)
	  {
		  $c = Doctrine_Query::create()
		  		->from('VTNSCms c')
				->where('cms_category_id = ?', $menuBottom['cms_category_id'])
				->addWhere('is_active = 1');
				
		  $cms_arr = $c->fetchArray();
		  if ($c->count() > 0)
		  	  $bottom = $cms_arr[0];
	  }
	  return $bottom;
	}
	
}


